package com.demo.thread.create;

/**
 * @author : YU.TAN
 * @date : 2021/11/1 13:45
 */
public class ThreadOne extends Thread {
    @Override
    public void run() {
        System.out.println("创建线程方法一！");
    }

    public static void main(String[] args) {
        /**
         * 写法一
         */
        for (int i = 0; i < 100; i++) {
            ThreadOne threadOne = new ThreadOne();
            threadOne.start();
            State state = threadOne.getState();

        }
        /**
         * 写法二(lambda)
         */
        Thread threadOne = new Thread(() -> System.out.println("创建线程方法一！"));
        threadOne.start();
    }
}
